eb694419fc399e327af9a0bd9612f96dc74c6405,deeplinkdispatch-processor/src/main/java/com/airbnb/deeplinkdispatch/internal/DeepLinkProcessor.java,DeepLinkProcessor,generateDeepLinkActivity,#,145

Before Change


    jw.emitStatement("startActivity(intent)");

    jw.nextControlFlow("catch (ClassNotFoundException exception)");
    jw.emitStatement("Log.e(TAG, \"Deep link to non-existent class: \" + entry.getActivity())");
    jw.nextControlFlow("catch (NoSuchMethodException exception)");
    jw.emitStatement("Log.e(TAG, \"Deep link to non-existent method: \" + entry.getMethod())");
    jw.nextControlFlow("catch (IllegalAccessException exception)");
    jw.emitStatement("Log.e(TAG, \"Could not deep link to method: \" + entry.getMethod())");
    jw.nextControlFlow("catch(InvocationTargetException  exception)");
    jw.emitStatement("Log.e(TAG, \"Could not deep link to method: \" + entry.getMethod())");
    jw.endControlFlow();

After Change


    jw.emitEmptyLine();

    jw.emitStatement("startActivity(intent)");
    jw.emitStatement("notifyListener(false, uri, null)");
    jw.nextControlFlow("catch (ClassNotFoundException exception)");
    jw.emitStatement("notifyListener(true, uri, \"Deep link to non-existent class: \" + entry.getActivity())");
    jw.nextControlFlow("catch (NoSuchMethodException exception)");
    jw.emitStatement("notifyListener(true, uri, \"Deep link to non-existent method: \" + entry.getMethod())");
    jw.nextControlFlow("catch (IllegalAccessException exception)");
    jw.emitStatement("notifyListener(true, uri, \"Could not deep link to method: \" + entry.getMethod())");
    jw.nextControlFlow("catch(InvocationTargetException  exception)");
    jw.emitStatement("notifyListener(true, uri, \"Could not deep link to method: \" + entry.getMethod())");
    jw.nextControlFlow("finally");
    jw.emitStatement("finish()");
    jw.endControlFlow();

    jw.nextControlFlow("else");
    jw.emitStatement(
        "notifyListener(true, uri, \"No registered entity to handle deep link: \" + uri.toString())");
    jw.emitStatement("finish()");
    jw.endControlFlow();

    jw.endMethod();

    jw.beginMethod("void", "notifyListener", EnumSet.of(Modifier.PRIVATE), "boolean",
                   "isError", "Uri", "uri", "String", "errorMessage");
    jw.beginControlFlow("if (getApplication() instanceof OnDeepLinkListener)");
    jw.emitStatement("OnDeepLinkListener listener = (OnDeepLinkListener) getApplication()");
    jw.beginControlFlow("if (!isError)");
    jw.emitStatement("listener.onDeepLinkSuccess(uri.toString())");
    jw.nextControlFlow("else");
    jw.emitStatement("listener.onDeepLinkError(new DeepLinkError(uri.toString(), errorMessage))");
    jw.endControlFlow();
    jw.endControlFlow();
    jw.endMethod();